using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_Projects : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }// end of the page load method
    protected void butCats_Click(object sender, EventArgs e)
    {
        Response.Redirect("projectcategories.aspx");
    }// end of the butCats_Click method
    protected void butStatuses_Click(object sender, EventArgs e)
    {
        Response.Redirect("projectstatuses.aspx");
    }// end of the butStatuses_Click method
    protected void butNewProject_Click(object sender, EventArgs e)
    {
        Response.Redirect("project.aspx");
    }// end of the butNewProject_Click method
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Response.Redirect("project.aspx?ID=" + GridView1.SelectedDataKey.Value.ToString());
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {

    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //on edit this is no delete button and this will chuck an exception if we try and get the button.
            if (e.Row.Cells[11].Controls.Count > 0)
            {
                LinkButton lbuDelete = (LinkButton)e.Row.Cells[11].Controls[0];
                lbuDelete.OnClientClick = "return confirm(\'Are you sure you want to delete? This can not be undone!\');";
            }// end of the check to see if there are any controls in the cell


            // the following code finds the delete button cell 
            //for (int intCounter = 0; intCounter < e.Row.Cells.Count; intCounter++)
            //{
            //    try
            //    {
            //        LinkButton lbuDelete = (LinkButton)e.Row.Cells[intCounter].Controls[0];

            //        if (lbuDelete.Text.ToLower().StartsWith("d"))
            //        {
            //          
            //            lbuDelete.OnClientClick = "alert(\'" + intCounter.ToString() + "\');return false;";
            //        }
            //    }
            //    catch
            //    {
            //    }
            //}    
        }// end of the if 
    }
    protected void butBlurb_Click(object sender, EventArgs e)
    {
        Response.Redirect("EditSiteContent.aspx?Type="+((int)ContentManager.SiteContentType.ProjectsSummary).ToString());
    }
}// end fo the class
